VMX: don't crash processing 'd' debug key
authorJan Beulich <jbeulich@suse.com>
Tue, 12 Nov 2013 10:52:19 +0000 (11:52 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Nov 2013 10:52:19 +0000 (11:52 +0100)
commit58929248461ecadce13e92eb5a5d9ef718a7c88e
tree88d53028cd66d0b9653d5b075318ef33611ff75a
parentb1e87805bf37b446dade93a7eb922bb7d1269756
VMX: don't crash processing 'd' debug key

There's a window during scheduling where "current" and the active VMCS
may disagree: The former gets set much earlier than the latter. Since
both vmx_vmcs_enter() and vmx_vmcs_exit() immediately return when the
subject vCPU is "current", accessing VMCS fields would, depending on
whether there is any currently active VMCS, either read wrong data, or
cause a crash.

Going forward we might want to consider reducing the window during
which vmx_vmcs_enter() might fail (e.g. doing a plain __vmptrld() when
v->arch.hvm_vmx.vmcs != this_cpu(current_vmcs) but arch_vmx->active_cpu
== -1), but that would add complexities (acquiring and - more
importantly - properly dropping v->arch.hvm_vmx.vmcs_lock) that don't
look worthwhile adding right now.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/hvm/vmx/vmcs.h